#!/bin/zsh
# -*-coding: latin-1;-*-

##########################################################
#
# title:     enviroment variables config
#
# filename:  /etc/zsh/zshenv
#
# author(s): Alessandro Molari (mola89.molarulez.com),
#            Luca Molari
#
# license:   This file is licensed under the GPLv2
#            For more informations read:
#            http://www.gnu.org/licenses/gpl-2.0.txt
#
# thanks to: zsh team (www.zsh.org)
#            grml team (grml.org)
#            Michael Prokop (mika@grml.org)
#
##########################################################



# setup the EDITOR variable
if [ -x /usr/bin/vim ]; then
    export EDITOR=${EDITOR:-vim}
elif [ -x /usr/bin/nano ]; then
    export EDITOR=${EDITOR:-nano}
fi

# setup the VISUAL variable (visual editor)
if [ -x /usr/bin/vim ]; then
    export VISUAL=${VISUAL:-vim}
elif [ -x /usr/bin/nano ]; then
    export VISUAL=${VISUAL:-nano}
fi

# add less to the PAGER variable
if [ -x /bin/less ]; then
    export PAGER=${PAGER:-less}
elif [ -x /bin/more ]; then
    export PAGER=${PAGER:-more}
fi

# set the SHELL variable as /bin/zsh
export SHELL=/bin/zsh

# enable ('1') or disable ('0') zsh profiling
export ZSH_PROFILE=0

# set the ZSHDIR_CUSTOM variable to the zsh user directory
if [ ! -d $HOME/.zsh ]; then
    mkdir $HOME/.zsh
fi
export ZSHDIR_USER=$HOME/.zsh

# set the cache directory
if [ ! -d $HOME/.zsh/cache ]; then
    mkdir $HOME/.zsh/cache
fi
export ZSHDIR_USER_CACHE=$ZSHDIR_USER/cache

# set the ZSHDIR_GLOBAL variable to the zsh global directory
export ZSHDIR_GLOBAL=/etc/zsh

# set the HISTFILE variable to the user history file
if [ ! -f $HOME/.zsh_history ]; then
    touch $HOME/.zsh_history
fi
export HISTFILE=$HOME/.zsh_history

# set the dirstack size
export DIRSTACKSIZE=${DIRSTACKSIZE:-30}
if [ ! -f $HOME/.zdirs ]; then
    touch $HOME/.zdirs
fi
export DIRSTACKFILE=${DIRSTACKFILE:-${HOME}/.zdirs}

# use the menu when completing
#     ZSH_COMP_MENU values: 0  =>  menu enabled
#                           1  =>  menu disabled
export ZSH_COMP_NOMENU=0

# set the default browser
export BROWSER=chromium


##         wine

# define the dict of wine executable files
if [[ -x /usr/bin/wine ]] && [[ -r $HOME/.wine/drive_c/Program\ Files/ ]] ; then
    WINEDIR_PROGS=$HOME/.wine/drive_c/Program\ Files
    typeset -A WINE_EXECS
    
    # add dict entries (key=name , value=path/to/the/exe/file)
    #     for launching wine programs quickly
    WINE_EXECS=(
        foxit $WINEDIR_PROGS/foxit\ phantom/Foxit\ Phantom.exe
    )
    
    export WINE_EXECS
fi

## end of: wine


# export the email directory
export MAIL=${MAIL:-/var/mail/$USER}

# export the temp directory
if [ -d $HOME/tmp ]; then
    export USERDIR_TMP=$HOME/tmp
fi

# export the work directory
if [ -d $HOME/workdir ]; then
    export USERDIR_WORKDIR=$HOME/workdir
fi

# export the documents directory
if [ -d $HOME/docs ]; then
    export USERDIR_DOCS=$HOME/docs
fi

# export the graphics directory
if [ -d $HOME/graphics ]; then
    export USERDIR_GRAPHICS=$HOME/graphics
fi

# export the audio directory
if [ -d $HOME/audio ]; then
    export USERDIR_AUDIO=$HOME/audio
fi

# export the video directory
if [ -d $HOME/video ]; then
    export USERDIR_VIDEO=$HOME/video
fi

# export the development directory
if [ -d $HOME/dev ]; then
    export USERDIR_DEV=$HOME/dev
fi

# export the downloads directory
if [ -d $HOME/downloads ]; then
    export USERDIR_DOWNLOADS=$HOME/downloads
fi

# export the public directory
if [ -d $HOME/public ]; then
    export USERDIR_PUBLIC=$HOME/public
fi
